<#assign menu="singlePage">
<#assign submenu="update_singlePage">
<#include "/system/head.ftl">
<style type="text/css">

</style>
<!--main content start-->
	<section id="main-content">
		<section class="wrapper">
		<!-- page start-->
			<div class="row">
			<div class="col-lg-12">
			<section class="panel">
				<header class="panel-heading">
 					修改单页
				</header>
				<div class="panel-body">
					<form id="update_singlePage_form" method="post" class="form-horizontal" autocomplete="off" action="${basePath}/admin/singlePage/update.json">
					<fieldset>
					<input type="hidden" name="singlePageEntity.id" id="id" value="<#if singlePageEntity??>${singlePageEntity.id}</#if>"/> 
                    <div class="form-group">
                        <label class="col-sm-2 col-sm-2 control-label">单页名称</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" name="singlePageEntity.title" value="<#if singlePageEntity??>${singlePageEntity.title}</#if>"
                            	placeholder="单页名称" id="title" >
                        </div>
                    </div>
                    <div class="form-group">
                      <label class="col-sm-2 col-sm-2 control-label">所属栏目</label>
                      <div class="col-sm-10">
                          <select class="form-control" id="classId" name="singlePageEntity.classId" style="font-size:15px;width: 300px;">
		                   		<#list classesList as classes>
		                   			<option style="background-color:#DFF0D8;font-weight:bold;" value="${classes.id}" selected>${classes.name}</option>
		                   		</#list>						
                            </select>			
                      </div>
                    </div>                                            
					<div class="form-group">
                          <label class="col-sm-2 col-sm-2 control-label">内容</label>
                          <div class="col-sm-10">
                              <script id="content" name="content" type="text/plain"
									style="width: 100%; height: 260px;">${singlePageEntity.content!}</script>
							  <script type="text/javascript">
								var contentEditor;
								$(function() {
									contentEditor = UE.getEditor('content');
								});
							  </script>
                          </div>
                    </div>
                    <div class="form-group">
                    	<label class="col-sm-2 col-sm-2 control-label"></label>
                        <button class="btn btn-danger" type="submit">修改</button>
                    </div>
                   </fieldset>
				</form>
				</div>
			</section>
		</div>
		</div>
<!-- page end-->
		</section>
	</section>
 <!--main content end-->
<script type="text/javascript">
	$(function() {
		$('#update_singlePage_form').ajaxForm({
			dataType : 'json',
			success : function(data) {
				if (data.result) {
					bootbox.alert("保存成功，将刷新页面", function() {
						window.location.reload();
					});
				}else{
					showErrors($('#update_singlePage_form'),data.errors);
				}
			},
			error:function(data,textstatus){
		        bootbox.alert({  
		            buttons: {  
		               ok: {  
		                    label: '关闭'
		               }  
		            },
		            message: textstatus+":"+data.responseText,
		            title: '<@spring.message "system.errorTip"/>',  
		        });
	        }
		});
	});	
</script>
<#include "/system/foot.ftl">
